import ColorBox from '../base/colorBox'

cc.Class({
    extends: cc.Component,

    properties: {
     
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        this.graphics = this.node.getComponent(cc.Graphics)
        this.colorSlider = new ColorBox(250, -250)
    },

    start () {
        this.drawSlider()
    },

    drawSlider() {
        this.colorSlider.update()
        let rdg = this.colorSlider.getRenderGroup()
        let g = this.graphics
        for (let p of rdg) {
            g.fillColor = p.color
            g.strokeColor = p.color
            g.rect(p.x, p.y, p.w, p.h)
            g.fill()
        }
        g.stroke()
    }

    // update (dt) {},
});
